
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
          name="viewport">
    <meta content="yes" name="apple-mobile-web-app-capable"/>
    <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
    <meta content="telephone=no" name="format-detection"/>
    <meta name="csrf-token" content="cPqshWzq8AP6CPB3WnTjWi7etMHthoseg6rFAYVE">
    <title>帐号管理</title>
    <meta name="description" content="帐号管理"/>
    <meta name="Keywords" content="帐号管理"/>


    {include file="common/link" /}
</head>

<body ontouchstart="">
<div class="weui-cells__title">帐号选择</div>
<div class="weui-cells weui-cells_radio showusers" >
    {volist name="users" id="vo"}
        <div class="showdata" data-id="{$vo.admin_id}">
            <label class="weui-cell weui-check__label " for="x{$key}" >
                <div class="weui-cell__bd chooseuser" data-id="{$vo.admin_id}" >
                    <p>{$vo.username}</p>
                </div>
                <div class="weui-cell__ft">
                    <input type="radio" class="weui-check" name="radio1" id="x{$key}"   {if condition="$vo.is_default == 1"} checked="checked" {else /} {/if}>
                    <span class="weui-icon-checked"></span>
                </div>
            </label>
        </div>
    {/volist}
</div>


<div class="weui-cells__title">绑定新账号</div>
<div class="weui-cells weui-cells_form">
    <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">帐号</label></div>
        <div class="weui-cell__bd">
            <input class="weui-input nickname" type="text"  placeholder="请输入帐号">
        </div>
    </div>
    <div class="weui-cell">
        <div class="weui-cell__hd"><label class="weui-label">密码</label></div>
        <div class="weui-cell__bd">
            <input class="weui-input password" type="text"  placeholder="请输入密码">
        </div>
    </div>
</div>


<div class="weui-btn-area">
    <a class="weui-btn weui-btn_primary" href="javascript:" id="showTooltips">确定</a>
</div>
</body>
{include file="common/left-nav" /}
{include file="common/script" /}
<script>
    $('.showusers').on('click','.showdata',function () {
        var url = "{$turl}"+'/web/users/userswitch'
        $.post(url,{admin_id:$(this).data('id')},function (res) {
            if(res.code == 2){
                return false;
            }
            layer.msg(res.msg)
        })
        // $(this).remove()
    })
    // $('.weui-check__label').click(function () {
    //     // $(this).remove()
    //     console.log($(this).data('id'))
    //     // alert($(this).data('id'))
    //     $(this).find('input').prop('checked',true)
    // })
    $('#showTooltips').click(function () {
        var nickname = $('.nickname').val()
        var password = $('.password').val()
        if(nickname == ''){
            layer.msg('账号不能为空')
        }
        if(password == ''){
            layer.msg('密码不能为空')
        }
        var url ="{$turl}"+'/web/users/addbinding'
        $.post(url,{nickname:nickname,password:password},function (res) {
            layer.msg(res.msg)
            if(res.code == 1){
                setTimeout(function () {
                    window.location.reload()
                },800)
            }
        })
    })
</script>
</html>

<!---不带扇形 带footer->
